<?php 

Class CmsCountrys extends CmsCustomFormItem {
	
    public function __init()
    {
		$this->cssClass = 'cms-clist';
		
        //$this->initTarget['custom_block'] = '';
    }
	
	public function __beforeRender(){
		global $regions;
		$data = isset($this->bind) ? $this->data[$this->bind] : array();
		$html = json_encode($data);
		$url = AC::$service_get_country;
		$regions = getStatsClass::getStatsFromXML();
		
		$tabs = '';
		foreach($regions as $region){
			$tabs .= '<li><a href="'.$url.'?region='.$region.'">'.$region.'</a></li>';
		}
		
		$this->target['custom_block'] = <<<HTML
		<input type="hidden" name="countrys" value='{$html}' />
		<div class="list ui-helper-clearfix"></div>
		<input type="button" value="Select Region/Country" class="ui-state-default ui-corner-all ui-button select-btn" />
		<input type="button" value="Reset" class="ui-state-default ui-corner-all ui-button reset-btn" />
		<div id="pop-clist" class="cms-clist">
			<ul>
				{$tabs}
			</ul>
		</div>
HTML;
	}
}
?>